import React from "react";
import {withRouter} from "react-router-dom";
import {inject, observer} from "mobx-react";
import {Tools} from "weaver-mobile";
import AccessHeader from "./header";

const getLabel = Tools.getLabel;

/**
 * 评分-相关链接
 */
@inject("accessViewStore")
@withRouter
@observer
export default class Relatelink extends React.Component {

    constructor(props) {
        super(props);
        this.store = this.props.accessViewStore;
    }

    render() {
        const {isplan,resourceid,linkUrlList,nowyear,type2,resourcename} = this.store;
        return [
            <AccessHeader showMsg={getLabel(24969, "相关链接")}/>,
            <div className="roll">
                <div className="accessview-row-div-relate">
                   <div className="accessview-row-col-linkurl"><a href={"/spa/blog/static4mobile/index.html#/userCenter/blogAttention/attention/hisBlog/" + resourceid} target="_blank" title={getLabel(509184, "{name}的工作微博").replace("{name}", resourcename)}>{getLabel(509184, "{name}的工作微博").replace("{name}", resourcename)}</a></div>
                    {isplan && <div className="accessview-row-col-linkurl"><a href={"/spa/workrelate/static4mobile/index.html#/planHome/planView/index?year=" + nowyear + "&type1=1&type2=" + type2 + "&resourceid=" + resourceid} target="_blank" title={getLabel(509323, "$name$的工作总结及计划").replace("$name$", resourcename) + "(" + nowyear + "-" + (type2 < 10 ? "0" + type2 : type2) + ")"}>{getLabel(509323, "$name$的工作总结及计划").replace("$name$", resourcename) + "(" + nowyear + "-" + (type2 < 10 ? "0" + type2 : type2) + ")"}</a></div>}
                    {/* {linkUrlList && linkUrlList.length > 0 && linkUrlList.map((element, idx) => {
                    return <div key={idx} className="accessview-row-col-linkurl"><a href={element.linkurl} target="_blank" title={element.linkname}>{element.linkname}</a></div>
                    })} */}
                </div>
            </div>
        ]
    }
}